import InternalRadio from './radio'
import Group from './group'

export interface AbstractCheckboxProps<T> {
  prefixCls?: string
  className?: string
  rootClassName?: string
  defaultChecked?: boolean
  checked?: boolean
  style?: React.CSSProperties
  disabled?: boolean
  title?: string
  onChange?: (e: T) => void
  onClick?: React.MouseEventHandler<HTMLElement>
  onMouseEnter?: React.MouseEventHandler<HTMLElement>
  onMouseLeave?: React.MouseEventHandler<HTMLElement>
  onKeyPress?: React.KeyboardEventHandler<HTMLElement>
  onKeyDown?: React.KeyboardEventHandler<HTMLElement>
  value?: any
  tabIndex?: number
  name?: string
  children?: React.ReactNode
  id?: string
  autoFocus?: boolean
  type?: string
  skipGroup?: boolean
}
export type RadioGroupOptionType = 'default' | 'button'
export interface RadioChangeEventTarget extends RadioProps {
  checked: boolean
}
export interface RadioChangeEvent {
  target: RadioChangeEventTarget
  stopPropagation: () => void
  preventDefault: () => void
  nativeEvent: MouseEvent
}
export interface RadioProps extends AbstractCheckboxProps<RadioChangeEvent> {
  /**
   * Control the appearance for Radio to display as button or not
   *
   * @default 'default'
   * @internal
   */
  optionType?: RadioGroupOptionType
}

type CompoundedComponent = React.ForwardRefExoticComponent<
RadioProps > & {
  Group: typeof Group
}

const Radio = InternalRadio as any
Radio.Group = Group
export default Radio
